﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="OnlineReport.aspx.cs" Inherits="OnlineReport_OnlineReport" %>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>基础数据维护</title>
    <base target="_self" />
    <link href="../css/css.css" rel="stylesheet" type="text/css" />
    <link href="../css/tab.css" type="text/css" rel="stylesheet" />

    <script src="../js/calendar.js" type="text/javascript"></script>

    <script src="../js/Common.js" type="text/javascript"></script>

    <script src="../JS/jquery.js" type="text/javascript"></script>

    <script language="javascript" type="text/javascript">

        function BtnSubmit() {
//            if (parseFloat($("#txtPowers_1").val()) + parseFloat($("#txtPowers_2").val()) + parseFloat($("#txtPowers_3").val()) != parseFloat($("#txtPowers").val())) {
//                alert("1.1生产管理用房耗电+1.2渠道用房耗电+1.3其它用房耗电不等于（1、耗电量）");
//                return;
//            }
//            if (parseFloat($("#txtPowers_1_1").val()) + parseFloat($("#txtPowers_1_2").val()) + parseFloat($("#txtPowers_1_3").val()) != parseFloat($("#txtPowers_1").val())) {
//                alert("通信机房+支撑系统用房+管理用房不等于（1.1生产管理用房耗电）");
//                return;
//            }
//            if (parseFloat($("#txtPowers_3_1").val()) + parseFloat($("#txtPowers_3_2").val()) != parseFloat($("#txtPowers_3").val())) {
//                alert("其中：基站机房+传输节点机房不等于（1.3其它用房耗电）");
//                return;
//            }
//            if (parseFloat($("#txtPowers_3_1_1").val()) + parseFloat($("#txtPowers_3_1_2").val()) + parseFloat($("#txtPowers_3_1_3").val()) != parseFloat($("#txtPowers_3_1").val())) {
//                alert("其中：GSM独立基站耗电量+TD-SCDMA独立基站耗电量+GSM&TD-SCDMA共站耗电量不等于（其中：基站机房：）");
//                return;
//            }
            //获取所有文本框值
            var ary = form1.hidTextList.value.split(',');
            for (i = 0; i < ary.length - 1; i++) {
                var txt = document.getElementById("txt" + ary[i]);
                if (txt.value != "")
                    form1.txtinfo.value += txt.value + "|" + ary[i] + ",";
            }
            
            var btnSave = window.document.getElementById("SaveData");
            if (btnSave != null)
                btnSave.click();
        }
        function getInfo(id) {
            if ($("#sltMonth").val() != "") {
                if ($("#lab" + id).text() == "") {
                    $.ajax({
                        type: "Post",
                        url: "OnlineReport.aspx/GetStr",
                        data: "{'sField':'" + id + "','sYear':'" + $("#sltYear").val() + "','sMonth':'" + $("#sltMonth").val() + "','sAreaID':'" + $("#sltArea").val() + "'}",
                        contentType: "application/json; charset=utf-8",
                        dataType: "json",
                        success: function(data) {
                            //$("#lab" + id).val(data.d);
                            $("#lab" + id).text("   上期值:" + data.d);
                        },
                        error: function(err) {
                            alert(err);
                        }
                    });
                }
            }
            else {
                alert("请选择月份！");
            }
        }
        function setInfo(month) {
            if ($("#sltMonth").val() != "") {
                var i = Math.random();
                if (month != "12" && month != "03" && month != "06" && month != "09") {
                    $.ajax({
                        type: "Post",
                        url: "OnlineReport.aspx/GetMonth",
                        data: "{'sYear':'" + $("#sltYear").val() + "','sMonth':'" + $("#sltMonth").val() + "','sAreaID':'" + $("#sltArea").val() + "','sFields':'" + form1.disabledinfo.value + "','sID':'" + i + "'}",
                        contentType: "application/json; charset=utf-8",
                        dataType: "json",
                        success: function(data) {
                            var info = data.d;
                            if (info != "")
                                var infoary = info.split(',');
                            var ary = form1.disabledinfo.value.split(',');
                            for (i = 0; i < ary.length - 1; i++) {
                                var txt = document.getElementById("txt" + ary[i]);
                                if (info != "" && infoary != null)
                                    txt.value = infoary[i];
                                txt.disabled = true;
                            }
                        },
                        error: function(err) {
                            alert(err);
                        }
                    });
                }
                else {
                    var ary = form1.disabledinfo.value.split(',');
                    for (i = 0; i < ary.length - 1; i++) {
                        var txt = document.getElementById("txt" + ary[i]);
                        txt.value = "";
                        txt.disabled = false;
                    }
                }
            }
            else {
                alert("请选择月份！");
            }
        }
    </script>

</head>
<body style="background-image: url('../images/hit_bg.gif');">
    <% 
        Response.ExpiresAbsolute = System.DateTime.Now.AddSeconds(-1);
        Response.Expires = 0;
        Response.CacheControl = "no-cache";
    %>
    <form id="form1" runat="server">
    <table width="98%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="327AC6">
        <tr style="height: 30; background-color: #F9F9FB">
            <td colspan="2">
            </td>
            <td>
                <input type="hidden" runat="server" id="txtinfo" />
                <input type="hidden" runat="server" id="disabledinfo" />
                <input type="hidden" runat="server" id="editinfo" />
                <asp:Button ID="SaveData" runat="server" class="button02" Text="提交" OnClick="SaveData_Click"
                    Width="0px" Height="0px" />
                <span id="an" runat="server">
                    <input type="button" id="btnSave" value="保存" class="button02" onclick="BtnSubmit();" />
                </span>
                <asp:Button ID="btnAduit" runat="server" Text="通过" CssClass="button02" OnClick="btnAduit_Click" />
                <asp:Button ID="btnUnAduit" runat="server" Text="不通过" CssClass="button04" OnClick="btnUnAduit_Click" />
                <input type="button" id="Button2" value="取消" class="button02" onclick="javascript:self.location='OnlineReportManage.aspx';" />
                <asp:Button ID="btnInf" runat="server" CssClass="button04" Text="参考信息" OnClick="btnInf_Click" />
            </td>
        </tr>
        <tr style="background-color: #F9F9FB; height: 25;">
            <td align="right" colspan="2" style="width: 40%">
                &nbsp;变化率：
            </td>
            <td>
                &nbsp;<asp:Label ID="labBHL" runat="server"></asp:Label>
            </td>
        </tr>
        <tr style="background-color: #F9F9FB; height: 25;">
            <td align="right" colspan="2" style="width: 40%">
                &nbsp;警戒值：
            </td>
            <td>
                &nbsp;<asp:Label ID="labBG" runat="server"></asp:Label>
            </td>
        </tr>
        <tr style="background-color: #F9F9FB; height: 25;">
            <td align="right" colspan="2" style="width: 40%">
                &nbsp;耗电值：
            </td>
            <td>
                &nbsp;<asp:Label ID="labHD" runat="server"></asp:Label>
            </td>
        </tr>
        <tr style="background-color: #F9F9FB; height: 25;">
            <td align="right" colspan="2" style="width: 40%">
                &nbsp;话务量：
            </td>
            <td>
                &nbsp;<asp:Label ID="labYWL" runat="server"></asp:Label>
            </td>
        </tr>
        <tr style="background-color: #F9F9FB; height: 25;">
            <td align="right" colspan="2" style="width: 40%">
                &nbsp;数据量：
            </td>
            <td>
                &nbsp;<asp:Label ID="labSJL" runat="server"></asp:Label>
            </td>
        </tr>
        <tr style="background-color: #F9F9FB; height: 25;">
            <td align="right" colspan="2" style="width: 40%">
                &nbsp;<strong>地区：</strong>
            </td>
            <td>
                &nbsp;<asp:DropDownList ID="sltArea" runat="server" Width="110px">
                </asp:DropDownList>
                <span style="color: #ff0000"></span>
            </td>
        </tr>
        <tr style="background-color: #F9F9FB; height: 25;">
            <td align="left" colspan="2" style="width: 40%">
                &nbsp;<strong>月份：</strong>
            </td>
            <td>
                &nbsp;<select id="sltYear" runat="server" style="width: 60px;">
                    <option value="2008">2008</option>
                    <option value="2009">2009</option>
                    <option value="2010" selected="selected">2010</option>
                    <option value="2011">2011</option>
                    <option value="2012">2012</option>
                    <option value="2013">2013</option>
                    <option value="2014">2014</option>
                    <option value="2015">2015</option>
                </select>&nbsp;<select id="sltMonth" runat="server" style="width: 40px;" onchange="setInfo(this.value)">
                    <option value="">请选择...</option>
                    <option value="01">01</option>
                    <option value="02">02</option>
                    <option value="03">03</option>
                    <option value="04">04</option>
                    <option value="05">05</option>
                    <option value="06">06</option>
                    <option value="07">07</option>
                    <option value="08">08</option>
                    <option value="09">09</option>
                    <option value="10">10</option>
                    <option value="11">11</option>
                    <option value="12">12</option>
                </select>
            </td>
        </tr>
        <%
            foreach (string fieldName in dicTable.Keys)
            {
        %>
        <tr style="background-color: #F9F9FB; height: 25;">
            <td align="left">
                &nbsp;<strong><%=dicTable[fieldName][0]%>：</strong>
            </td>
            <td>
                <%=dicTable[fieldName][2]%>
            </td>
            <td>
                &nbsp;<input id="txt<%=fieldName%>" onclick="getInfo('<%=fieldName %>')" type="text" /><%=dicTable[fieldName][1]%><label
                    id="lab<%=fieldName%>"></label>
            </td>
        </tr>
        <%      
            }
        %>
        <tr id="trRemark" style="background-color: #F9F9FB; height: 25;">
            <td colspan="2" align="left">
                &nbsp;<strong>审核意见</strong>
            </td>
            <td>
                &nbsp;<textarea id="txtRemark" runat="server" cols="30" rows="6"></textarea>
            </td>
        </tr>
    </table>
    <asp:Button ID="btnGetInfo" runat="server" Text="" Width="0px" Height="0px" OnClick="btnGetInfo_Click" />
    <input id="hidTextList" runat="server" type="hidden" />
    <input id="hidID" runat="server" type="hidden" />
    <input id="hidAreaid" runat="server" type="hidden" />
    </form>

    <script language="javascript" type="text/javascript">
        var editinfo = form1.editinfo.value;
        if (editinfo != "") {
            var ary = editinfo.split(',');
            for (i = 0; i < ary.length; i++) {
                var ary1 = ary[i].split('|');
                if (ary1[1] == "Area_ID") {
                    document.getElementById("sltArea").value = ary1[0];
                    continue;
                }
                if (ary1[1] == "Years") {
                    document.getElementById("sltYear").value = ary1[0];
                    continue;
                }
                if (ary1[1] == "Months") {
                    debugger;
                    document.getElementById("sltMonth").value = ary1[0];
                    continue;
                }
                var txt = document.getElementById("txt" + ary1[1]);
                if (txt != null)
                    txt.value = ary1[0];
            }
        }
    </script>

</body>
</html>
